﻿CREATE FUNCTION [dbo].[fn_UserExists]
(
	@User sysname
)
RETURNS BIT
AS
BEGIN
	DECLARE @True  BIT; SET @True  = 1
	DECLARE @False BIT; SET @False = 0
	
	IF EXISTS (
	       SELECT *
	       FROM   sys.database_principals dp
	       WHERE  dp.[name] = @User
	   )
	    RETURN @True
	
	RETURN @False
END